<div class="side-visit">
    <h2>大咖专访</h2>
    <div class="visit-main">
        <a id="fresh" class="more">换一批</a>
    </div>
</div>
<script type="text/javascript">
    $(function(){
        initDaka();

        $('#fresh').on('click',function(){
            initDaka();
        });
    });
    function initDaka(){
        var r = Math.ceil(Math.random()*5);
        $.ajax({
            url: '${base}/getDakaRandom',
            type: 'GET',
            data: {"page":r},
            dataType: 'json',
            success:function(res){
                var html = template.render(contentsTpl)(res);

                $('.visit-main').html(html);

                
            }
        });
        var contentsTpl=''+
                '{{each data.list as v i}}'+
                ' <dl class="clearfix">'+
                '    <dt class="f-l">' +
                '       <div style="height:100%;width:160%;margin-left: -30%;text-align: center">' +
                '           <img style="height:100%;width:auto" src="${base}/system/getImg?imgId={{v.postImg}}&w=112" alt="{{v.postTitle}}"/>'+
                '       </div>'+
                '   </dt>'+
                '    <dd class="f-l"><a href="${base}/posts/{{v.id}}">{{v.postTitle}}</a></dd>'+
                ' </dl>'+
                '{{/each}}';
    }
</script>